<?php require_once('../conn/DBconnect.php');

	session_start();
	
	if(isset($_POST["r_firstName"]))
	{
		$_SESSION['r_firstName'] = $_POST["r_firstName"];
	 	$_SESSION['r_lastName'] = $_POST["r_lastName"];
	 	$_SESSION['r_middle_ini'] = $_POST["r_middle_ini"];
	 	$_SESSION['r_gender'] = $_POST["r_gender"];
	 	$_SESSION['r_birthdate'] = $_POST["r_birthdate"];
	 	$_SESSION['r_email'] = $_POST["r_email"];
	 	$_SESSION['r_mobile'] = $_POST["r_mobile"];
	 	$_SESSION['r_nationality'] = $_POST["r_nationality"];
	 	$_SESSION['r_country'] = $_POST["r_country"];
	 	$_SESSION['r_address1'] = $_POST["r_address1"];
	 	$_SESSION['r_address2'] = $_POST["r_address2"];
	 	$_SESSION['r_delivery_add'] = $_POST["r_delivery_add"];
	 	$_SESSION['r_contact_name'] = $_POST["r_contact_name"];
	 	$_SESSION['r_contact_phone'] = $_POST["r_contact_phone"];
	 	
	 	setcookie("r_firstName",  $_POST["r_firstName"], time()+3600);
	 	setcookie("r_lastName",  $_POST["r_lastName"], time()+3600);
	 	setcookie("r_middle_ini",  $_POST["r_middle_ini"], time()+3600);
	 	setcookie("r_gender",  $_POST["r_gender"], time()+3600);
	 	setcookie("r_birthdate",  $_POST["r_birthdate"], time()+3600);
	 	setcookie("r_email",  $_POST["r_email"], time()+3600);
	 	setcookie("r_mobile",  $_POST["r_mobile"], time()+3600);
	 	setcookie("r_nationality",  $_POST["r_nationality"], time()+3600);
	 	setcookie("r_country",  $_POST["r_country"], time()+3600);
	 	setcookie("r_address1",  $_POST["r_address1"], time()+3600);
	 	setcookie("r_address2",  $_POST["r_address2"], time()+3600);
	 	setcookie("r_delivery_add",  $_POST["r_delivery_add"], time()+3600);
	 	setcookie("r_contact_name",  $_POST["r_contact_name"], time()+3600);
	 	setcookie("r_contact_phone",  $_POST["r_contact_phone"], time()+3600);
	}
	 	
$kitSize = "";
$kitColor = "";

if(isset($_POST["r_size"]))
{
	$kitSize = $_POST["r_size"];
}
	
if(isset($_POST["r_color"]))
{
 	$kitColor = $_POST["r_color"];
}

?>

<div id="div-container">
	<div id="div-content">
		<div class="formItem">
			<div class="formTitleLabel" style="font-size:14px; ">COLOR RUN T-shirt</div>
		</div>
		<div id="div-sizeColor">
			<div id="div-size">
				<div class="divSpacer"></div>
				<div class="formTitleLabel" style="width:320px;margin-left: 15px;"><font color="#ff0000">*</font>SIZE</div>
				<div class="formItem">
					<div class="formLabel" style="width:170px;font-weight: bold">Select:</div>
					<div class="formLabel" style="font-weight: bold">Price:</div>
				</div>
				<?php 
	
				$kitSizeSQL = "call sp_kit('LIST','EVENT_KIT_SIZE', 1, 1, null);";
		
				$resultSize = mysqli_query($mysqlLink, $kitSizeSQL);
				
				$checkItem = false;
				if($resultSize->num_rows == 1)
					$checkItem = true;
					
				while ($row = mysqli_fetch_array($resultSize, MYSQLI_ASSOC)) {
					
				?>
				<div class="formItem">
					<div><input type="radio" name="kitSize" value="<?php echo $row["ks_code"]?>" <?php if($checkItem || $kitSize == $row["ks_code"]){ echo "checked='checked'";}?>></div>
					<div class="formLabel"><?php echo $row["ks_desc"]?></div>
					<div class="formLabel">Included</div>
				</div>
				<?php }?>
			</div>
			
			<div id="div-color">
				<div class="divSpacer"></div>
				<div class="formTitleLabel" style="margin-left: 15px;"><font color="#ff0000">*</font>COLOR</div>
				
				<?php 
			
				mysqli_free_result($resultSize);
				mysqli_next_result($mysqlLink); 
				
				$kitColorSQL = "call sp_kit('LIST','EVENT_KIT_COLOR', 1, 1, null);";
		
				$resultColos = mysqli_query($mysqlLink, $kitColorSQL);
				
				$checkItem = false;
				if($resultColos->num_rows == 1)
					$checkItem = true;
					
				while ($rowColor = mysqli_fetch_array($resultColos, MYSQLI_ASSOC)) {
					
				?>
				<div class="formItem">
					<div><input type="radio" name="kitColor" value="<?php echo $rowColor["kc_code"]?>" <?php if($checkItem || $kitColor == $rowColor["kc_code"]){ echo "checked='checked'";}?>></div>
					<div class="formLabel"><?php echo $rowColor["kc_code"]?></div>
				</div>
				<?php 
				}
				
				mysqli_free_result($resultColos);
				
				mysqli_close($mysqlLink);
		
				?>
				
			</div>
			
			<div style="padding: 10px 0px;display: block;clear:both;">
				<hr class="hrSolidLine">
				<div id="addRunnerForm"></div>
				<div class="formButtonMenu" style="float:left;">
					<div class="blue-buttonBL"></div>
					<div class="blue-buttonM" style="width:90px;">
					<a href="javascript:addRunner()">Add Runner</a>
					</div>
					<div class="blue-buttonBR"></div>
				</div>
			</div>
			
			<div style="padding: 10px 0px;display: block;clear:both;">
				<div class="divSpacer"></div>
				<div id="div-header">
					<div class="div-header-title">
						<div class="dh-title-left"></div>
						<div class="dh-title-center">Waivers and agreements</div>
						<div class="dh-title-right"></div>
					</div>
				</div>
				<div class="divTextContent">
					<p align="justify"><b>Please read the following <a href="javascript:openWin('popdocument.php?cmsType=privacypolicy','privacypolicy')">privacy policy</a>, waivers and agreement carefully. 
					They include release if liability and waiver for legal rights, and deprive you the ability to sue certain parties. 
					By agreeing electronically, you acknowledge that you have read and understand all text presented to you as part of the registration process.</b></p>
					<br><input name="waiverChecked" type="checkbox"> I agree to the <a href="javascript:openWin('popdocument.php?cmsType=waiver','waiver')">Waiver of Liability</a>.
					<br><input name="termsConditionChecked" type="checkbox"> I agree to the <a href="javascript:openWin('popdocument.php?cmsType=termcondition','termcondition')">Terms and Conditions</a>.
					
				</div>
			</div>
		</div>
	</div>
	
	
	<input type="hidden" name="promoNo" value="0">
	<input type="hidden" name="regOutlet" value="0">
	<input type="hidden" name="regCategory" value="0">
</div>
